<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>    

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<c:url value="/resources/homepage.css" />" rel="stylesheet">
<title>Admin Home Page</title>
</head>
<script type="text/javascript">

function EditEmp(id)
{
	    window.open("Editemp.jsp?&id="+id,"Edit EMP Details window", 'height=200px width=200px',false);
	    //location.href("Editemp.jsp");
}

function funValid()
{
 // alert("Are you sure you want to delete the employee ?");	
var msg=confirm("Are you sure you want to delete the employee ?");
	if(msg==true);
	else
		{
			location.href("Addemp.jsp");
		}
	
}
</script>

<body>
			<sql:setDataSource
			var="myDS"
			driver="com.mysql.jdbc.Driver"
			url="jdbc:mysql://localhost:3306/springct"
			user="root" password="dhanashree"/>
		
		<sql:query var="listUsers"	dataSource="${myDS}">
			 select emp_id, first_name, last_name, email_id, designation_name from employee,designation where employee.designation_id=designation.designation_id;		
		</sql:query>
	
	<div id="wrapper">
		<!-- ============ HEADER SECTION ============== -->
		<div id="header">
			<div id="headerlogo"></div>
		</div>
		<!-- ============ NAVIGATION SECTION ============== -->
		<div id="menubar">

			<ul>
				<li><a href="Addemp">Employee</a></li>
				<li><a href="Addrole">Role</a></li>
				<li><a href="Platform">Platform</a>
				</li>
				<li><a href="AddClient">Client</a>
				</li>
				<li><a href="AddStoryPoints">Story Points</a>
				</li>

				<li><a href="logout">Logout</a>
				</li>
			</ul>
		</div>


		<div id="main">
		<div id="searchbar">
<input type="text" name="q" size="125" placeholder="search..."/><input type="submit" value="search" name="login" class="buttonStyle"/>
</div>
<br>
<div id="scroller">		
				<table>
					<tr>
						<th>Employee ID</th>
						<th>Employee Name</th>
						<th>Employee Username</th>
						<th>Designation</th>
<!-- 						<th>Role</th> -->
					</tr>

		<!--  			<tr>
						<td>E1</td>
						<td>ABC</td>
						<td>ABC@gmail.com</td>
						<td>P1</td>
						<td>Team Member</td>
						<td>Team member</td>
	<td>     
        <select name="Edit">
        <option  value="Edit1" onclick="EditEmp('E1')">Edit</option>		
        <option  value="Delete" onclick="return funValid()">Delete</option>	
        </select>		
</td>

						</td>
					</tr>

					<tr class="cellcolor">
						<td></td>
						<td></td>
						<td></td>
						<td>P2</td>
						<td>Project Manager</td>
						<td>Scrum Master</td>
<td>     
        <select name="Edit">
        <option  value="Edit1" onclick="EditEmp('E2')">Edit</option>		
        <option  value="Delete" onclick="return funValid()">Delete</option>	
        </select>		
</td>

						</td>
					</tr>

					<tr>
						<td>E2</td>
						<td>XYZ</td>
						<td>XYZ@gmail.com</td>
						<td>P2</td>
						<td>Team Member</td>
						<td>Team Member</td>
<td>     
        <select name="Edit">
        <option  value="Edit" onclick="EditEmp('E2')">Edit</option>		
        <option  value="Delete" onclick="return funValid()">Delete</option>	
        </select>		
</td>

						</td>
					</tr>


					<tr class="cellcolor">
						<td></td>
						<td></td>
						<td></td>
						<td>P6</td>
						<td>Team Member</td>
						<td>Team Member</td>
<td>     
        <select name="Edit">
        <option  value="Edit" onclick="EditEmp('E2')">Edit</option>		
        <option  value="Delete" onclick="return funValid()">Delete</option>	
        </select>		
</td>

						</td>
					</tr>



					<tr>
						<td></td>
						<td></td>
						<td></td>
						<td>P4</td>
						<td>Team Member</td>
						<td>Team Member</td>
<td>     
        <select name="Edit">
        <option  value="Edit" onclick="EditEmp('E2')">Edit</option>		
        <option  value="Delete" onclick="return funValid()">Delete</option>	
        </select>		
</td>

						</td>
					</tr>


					<tr class="cellcolor">
						<td>E3</td>
						<td>PQR</td>
						<td>PQR@gmail.com</td>
						<td>P3</td>
						<td>Project Manager</td>
						<td>Scrum Master</td>
<td>     
        <select name="Edit">
        <option  value="Edit" onclick="EditEmp('E3')">Edit</option>		
        <option  value="Delete" onclick="return funValid()">Delete</option>	
        </select>		
</td>

						</td>
					</tr>

					<tr>
						<td>E4</td>
						<td>LMN</td>
						<td>LMN@gmail.com</td>
						<td>P5</td>
						<td>Team Member</td>
						<td>Team Member</td>
<td>     
        <select name="Edit">
        <option  value="Edit" onclick="EditEmp('E4')">Edit</option>		
        <option  value="Delete" onclick="return funValid()">Delete</option>	
        </select>		
</td>

						</td>
					</tr>
				-->
				<c:forEach var="user" items="${listUsers.rows}">
				<tr>
					<td><a href="Editemp.jsp"><c:out value="${user.emp_id}"/></a></td>
					<td><c:out value="${user.first_name} ${user.last_name}" /></td>
					<td><c:out value="${user.email_id}" /></td>
<%-- 					<td><c:out value="${user.project_id}" /></td> --%>
					<td><c:out value="${user.designation_name}" /></td>
<%-- 					<td><c:out value="${user.role_name}" /></td> --%>
		<!-- 			<td>     
        				<select name="Edit">
        				<option  value="Edit" onclick="EditEmp('1')">Edit</option>		
        				<option  value="Delete" onclick="return funValid()">Delete</option>	
        				</select>		
					</td>
		-->
				</tr>
				</c:forEach>
				</table>
</div>
		</div>


		<div id="footer">
			<p>Copyright &copy; 2014 - All Rights Reserved - Spring Computing
				Pvt. Ltd.</p>
		</div>
	</div>
</body>
</html>